package com.example.demo.client.vm.sysbasequery;

import com.example.demo.format.TreeFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.ibatis.type.Alias;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author zhengmf
 * @Date 2019/1/9  15:09
 */
@Alias("HelpCatalogVm")
@ApiModel("菜单关联的帮助目录树")
public class HelpCatalogVm implements TreeFormat<HelpCatalogVm, Long>, Serializable {
    private static final long serialVersionUID = 1477053747075345689L;
    @ApiModelProperty("目录ID")
    private Long catalogId;
    @ApiModelProperty("目录名称")
    private String catalogName;
    @ApiModelProperty("上级目录ID")
    private Long parentId;
    @ApiModelProperty("是否选中")
    private boolean checked;
    @ApiModelProperty("子元素")
    private List<HelpCatalogVm> children;

    public Long getCatalogId() {
        return catalogId;
    }

    public void setCatalogId(Long catalogId) {
        this.catalogId = catalogId;
    }

    public String getCatalogName() {
        return catalogName;
    }

    public void setCatalogName(String catalogName) {
        this.catalogName = catalogName;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public boolean isChecked() {
        return checked;
    }

    public void setChecked(boolean checked) {
        this.checked = checked;
    }

    public List<HelpCatalogVm> getChildren() {
        return children;
    }

    public void setChildren(List<HelpCatalogVm> children) {
        this.children = children;
    }

    @Override
    public Long getId() {
        return catalogId;
    }

    @Override
    public Long getParentId() {
        return parentId;
    }

    @Override
    public void addChildren(HelpCatalogVm child) {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        this.children.add(child);
    }
}
